package ttOrder.dao.inter;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;

import ttOrder.model.po.DinnerTable;
import ttOrder.model.po.Food;
import ttOrder.model.po.FoodType;
import ttOrder.model.po.Order;
import ttOrder.model.po.User;
import ttOrder.util.MyMapper;

@Mapper
public interface OrderMapper extends MyMapper<Order>{
	
	/**
	 * 基于注解实现的新增订单方法,实现新增时的主键ID自动回写
	 * @author emoker
	 * 
	 * */
	@Insert("insert into orders (id,table_id,user_id,total_price,order_time,vip,order_status) values (#{id},#{tableId},#{userId},#{totalPrice},#{orderTime},#{vip},#{orderStatus})")
	@SelectKey(before = false, keyProperty = "id", resultType = Integer.class, statement = { "select LAST_INSERT_ID()" })
	int insertOrder(Order record);
}
